<!DOCTYPE html>
<html lang="en-gb" dir="ltr">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Dropdown - UIkit tests</title>
        <script src="js/test.js"></script>
        <style>

            .test {
                display: block;
                position: relative;
                width: 100%;
            }

            .scroll-container {
                padding: 15px;
                border: 1px dashed rgba(0,0,0,0.2);
                overflow: auto;
            }

        </style>
    </head>

    <body>

        <div class="uk-container">

            <h1>Dropdown</h1>

            <div class="uk-margin">
                <select id="js-size-switcher" class="uk-select uk-form-width-small" aria-label="Size switcher">
                    <option value="">Default</option>
                    <option value="uk-dropdown-large">Large</option>
                </select>
            </div>

            <div uk-grid>
                <div class="uk-width-1-4@m">

                    <div class="uk-drop uk-dropdown test">

                        <ul class="uk-nav uk-dropdown-nav">
                            <li class="uk-active"><a href="#">Active</a></li>
                            <li class="uk-parent">
                                <a href="#">Parent</a>
                                <ul class="uk-nav-sub">
                                    <li><a href="#">Sub item</a></li>
                                    <li><a href="#">Sub item</a>
                                        <ul>
                                            <li><a href="#">Sub item</a></li>
                                            <li><a href="#">Sub item</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </li>
                            <li class="uk-parent">
                                <a href="#">Parent</a>
                                <ul class="uk-nav-sub">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Sub item</a></li>
                                </ul>
                            </li>
                            <li class="uk-nav-header">Header</li>
                            <li><a href="#"><span class="uk-margin-xsmall-right" uk-icon="icon: table"></span> Item</a></li>
                            <li><a href="#"><span class="uk-margin-xsmall-right" uk-icon="icon: thumbnails"></span> Item</a></li>
                            <li class="uk-nav-divider"></li>
                            <li><a href="#"><span class="uk-margin-xsmall-right" uk-icon="icon: trash"></span> Item</a></li>
                        </ul>

                    </div>

                </div>
                <div class="uk-width-1-4@m">

                    <div class="uk-drop uk-dropdown test">

                        <ul class="uk-nav uk-nav-secondary">
                            <li class="uk-active"><a href="#"><div>Active<div class="uk-nav-subtitle">Subtitle lorem ipsum dolor sit amet, consectetur adipiscing.</div></div></a></li>
                            <li><a href="#"><div>Item<div class="uk-nav-subtitle">Subtitle lorem ipsum dolor sit amet, consectetur adipiscing.</div></div></a></li>
                            <li><a href="#"><div>Item<div class="uk-nav-subtitle">Subtitle lorem ipsum dolor sit amet, consectetur adipiscing.</div></div></a></li>
                            <li><a href="#"><div>Item<div class="uk-nav-subtitle">Subtitle lorem ipsum dolor sit amet, consectetur adipiscing.</div></div></a></li>
                        </ul>

                    </div>

                </div>
                <div class="uk-width-1-2@m">

                    <div class="uk-margin" uk-margin>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Scrollable</button>
                            <div class="uk-overflow-auto uk-height-medium uk-dropdown" uk-drop>
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li class="uk-parent">
                                        <a href="#">Parent</a>
                                        <ul class="uk-nav-sub">
                                            <li><a href="#">Sub item</a></li>
                                            <li><a href="#">Sub item</a></li>
                                        </ul>
                                    </li>
                                    <li class="uk-nav-header">Header</li>
                                    <li><a href="#"><span class="uk-margin-xsmall-right" uk-icon="icon: table"></span> Item</a></li>
                                    <li><a href="#"><span class="uk-margin-xsmall-right" uk-icon="icon: thumbnails"></span> Item</a></li>
                                    <li class="uk-nav-divider"></li>
                                    <li><a href="#"><span class="uk-margin-xsmall-right" uk-icon="icon: trash"></span> Item</a></li>
                                </ul>
                            </div>
                        </div>

                    </div>

                    <h2>Position</h2>

                    <div class="uk-margin" uk-margin>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Bottom Left</button>
                            <div class="uk-dropdown" uk-drop>
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Bottom Center</button>
                            <div class="uk-dropdown" uk-drop="pos: bottom-center">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Bottom Right</button>
                            <div class="uk-dropdown" uk-drop="pos: bottom-right">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                    </div>

                    <div class="uk-margin" uk-margin>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Top Left</button>
                            <div class="uk-dropdown" uk-drop="pos: top-left">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Top Center</button>
                            <div class="uk-dropdown" uk-drop="pos: top-center">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Top Right</button>
                            <div class="uk-dropdown" uk-drop="pos: top-right">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                    </div>

                    <div class="uk-margin" uk-margin>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Left Top</button>
                            <div class="uk-dropdown" uk-drop="pos: left-top">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Left Center</button>
                            <div class="uk-dropdown" uk-drop="pos: left-center">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Left Bottom</button>
                            <div class="uk-dropdown" uk-drop="pos: left-bottom">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                    </div>

                    <div class="uk-margin" uk-margin>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Right Top</button>
                            <div class="uk-dropdown" uk-drop="pos: right-top">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Right Center</button>
                            <div class="uk-dropdown" uk-drop="pos: right-center">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                        <div class="uk-inline">
                            <button class="uk-button uk-button-default" type="button">Right Bottom</button>
                            <div class="uk-dropdown" uk-drop="pos: right-bottom">
                                <ul class="uk-nav uk-dropdown-nav">
                                    <li class="uk-active"><a href="#">Active</a></li>
                                    <li><a href="#">Item</a></li>
                                    <li><a href="#">Item</a></li>
                                </ul>
                            </div>
                        </div>

                    </div>

                </div>
            </div>

        </div>

        <script>

            const {$$, addClass, on, removeClass } = UIkit.util;

            on('#js-size-switcher', 'change', (e) => {
                const options = $$('option', e.target).map(({value}) => value);
                for (const dropdown of $$('.uk-dropdown')) {
                    removeClass(dropdown, options);
                    addClass(dropdown, e.target.value);
                }
            });

        </script>

    </body>
</html>
